#ifndef _SPRITE_H_
#define _SPRITE_H_

#include <d3dx9.h>

class CSprite
{
private:
	LPDIRECT3DTEXTURE9 m_texture;
	int m_height;
	int m_width;
	int m_numCol;
	int m_numRow;
	int m_curFrame;
	int m_frameWidth;
	int m_frameHeight;
	float m_timeAnimation;
	float m_timeCurrent;

	RECT m_rect;

	void UpdateRect();
public:
	CSprite(void);
	~CSprite(void);
	D3DXVECTOR2 m_pos;
	CSprite(int width, int height, float x, float y, int curFrame, int frameWidth, int frameHeight, float timeAnimation);
	void Init(LPDIRECT3DTEXTURE9 texture);
	void Update(float gameTime);
	void Update(float gameTime, int frameStart, int frameEnd);
	void Draw(LPD3DXSPRITE spriteHandler);

	int GetFrameWidth() { return m_frameWidth; }
	int GetFrameHeight() { return m_frameHeight;}
	void SetTimeAnimation(float time) { m_timeAnimation = time; }
	void SetCurrentFrame(int frame) { m_curFrame = frame; }
};
#endif


